home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf;
-
- import com.sun.java.swing.BorderFactory;
- import com.sun.java.swing.border.Border;
- import com.sun.java.swing.border.LineBorder;
- import java.awt.Component;
- import java.awt.Graphics;
- import java.awt.Insets;
- import java.io.Serializable;
-
- public class BorderUIResource implements Border, UIResource, Serializable {
- static BorderUIResource etched;
- static BorderUIResource loweredBevel;
- static BorderUIResource raisedBevel;
- static BorderUIResource blackLine;
- private Border delegate;
-
- public BorderUIResource(Border delegate) {
- if (delegate == null) {
- throw new IllegalArgumentException("null border delegate argument");
- } else {
- this.delegate = delegate;
- }
- }
-
- public static BorderUIResource getBlackLineBorderUIResource() {
- if (blackLine == null) {
- blackLine = new BorderUIResource(LineBorder.createBlackLineBorder());
- }
-
- return blackLine;
- }
-
- public Insets getBorderInsets(Component c) {
- return this.delegate.getBorderInsets(c);
- }
-
- public static BorderUIResource getEtchedBorderUIResource() {
- if (etched == null) {
- etched = new BorderUIResource(BorderFactory.createEtchedBorder());
- }
-
- return etched;
- }
-
- public static BorderUIResource getLoweredBevelBorderUIResource() {
- if (loweredBevel == null) {
- loweredBevel = new BorderUIResource(BorderFactory.createLoweredBevelBorder());
- }
-
- return loweredBevel;
- }
-
- public static BorderUIResource getRaisedBevelBorderUIResource() {
- if (raisedBevel == null) {
- raisedBevel = new BorderUIResource(BorderFactory.createRaisedBevelBorder());
- }
-
- return raisedBevel;
- }
-
- public boolean isBorderOpaque() {
- return this.delegate.isBorderOpaque();
- }
-
- public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
- this.delegate.paintBorder(c, g, x, y, width, height);
- }
- }
-